<%@include file="/WEB-INF/common/taglibs.jsp"%>
<script type="text/javascript"
	src="${supr}/plugins/forms/select/select2.min.js"></script>
<link href="${supr}/plugins/forms/select/select2.css" type="text/css"
	rel="stylesheet" />

<style>
.select2-choice {
	min-width: 200px;
}
</style>

<script>
	$(document).ready(function() {
		var opts = $("#LS-source").html();

		$("#unit-select").html(opts);
		$("#unit-select").val('${entity.unitNumber}');
		$("#unit-select").select2({
			minimumInputLength : 2,
			formatInputTooShort : function(input, min) {
				return "Please enter block number"
			}
		});

	});
</script>
<c:set var="allTemplate" value="${requestScope.templates}" />

<div class="row-fluid">
	<div class="span8">
		<div class="row-fluid">
			<div class="box gradient">
				<form:form method="post" modelAttribute="user" id="form">
					<input type="hidden" name="_method" value="${_method }" />
					<div class="title">
						<h4 class="clearfix">
							<span class="left"> New </span> <a href="#" class="minimize">Minimize</a>
							<span class="box-form right">
								<button class="btn btn-success btn-mini" type="submit">Submit</button>
							</span>
						</h4>
					</div>
					<div class="content form-horizontal clearfix">
						<div class="form-row row-fluid">
							<label class="form-label span4">UserName</label> <input
								class="span8" type="text" value="${entity.userName}"
								name="userName" />
						</div>

						<div class="form-row">
							<label class="form-label span4">Password </label> <input
								class="span8" name="password" type="password"
								value="${entity.password}" />
						</div>

						<div class="form-row">
							<label class="form-label span4">NRIC </label> <input
								class="span8" name="nric" type="text" value="${entity.nric}" />
						</div>

						<div class="form-row">
							<label class="form-label span4">Birthday </label> <input
								class="span4 datepicker" year=true month=true name="birthday"
								type="text"
								value="<fmt:formatDate pattern="yyyy-MM-dd" value="${entity.birthday}" />">
						</div>

						<div class="form-row row-fluid">
							<label class="form-label span4">EmailAddress</label> <input
								class="span8" type="text" value="${entity.email}" name="email" />
						</div>
						<div class="form-row row-fluid">
							<label class="form-label span4">Login Name</label> <input
								class="span8" type="text" name="loginName"
								value="${entity.loginName}" />
						</div>

						<div class="form-row row-fluid">
							<label class="form-label span4">Gender:</label>
							<div class="span4 controls">
								<select name="gender">
									<c:if test="${not empty genders}">
										<c:forEach var="gender" items="${genders}">
											<option value="${gender}"
												${(gender == entity.gender)?'selected':'' }>${gender}</option>
										</c:forEach>
									</c:if>
								</select>
							</div>
						</div>
						<!--mobile -->
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="mobile">Mobile :</label><input
										class="span4" id="mobile" name="mobile" type="text"
										value="${entity.mobile}" />
								</div>
							</div>
						</div>


						<div class="form-row row-fluid">
							<label class="form-label span4" for="email">Unit Number</label>
							<div class="span8 controls">
								<select id="unit-select" width="300px" type="text"
									name="unitNumber" class="nostyle"></select>
							</div>
						</div>
						<div class="form-row row-fluid">
							<label class="form-label span4"> Status </label>

							<div class="span8 controls">
								<select name="status" id="status">
									<option value="ACTIVE"
										<c:if test="${entity.status eq 'ACTIVE'}">
 	                      		selected="selected"
  	                      		</c:if>>Active</option>
									<option value="Disable"
										<c:if test="${entity.status eq 'Disable'}">
 	                      		selected="selected"
  	                      		</c:if>>Disable</option>
								</select>
							</div>

						</div>

						<div class="form-row row-fluid">
							<label class="form-label span4"> Account Type </label>

							<div class="span8 controls">
								<select name="residentType" id="status">
									<option value="Tenant"
										<c:if test="${entity.residentType eq 'Tenant'}">
 	                      		selected="selected"
  	                      		</c:if>>Tenant
									</option>
									<option value="Owner"
										<c:if test="${entity.residentType eq 'Owner'}">
 	                      		selected="selected"
  	                      		</c:if>>Owner
									</option>
								</select>
							</div>

						</div>

						<!--allowBook -->
						<div class="form-row row-fluid">
							<div class="span12">
								<div class="row-fluid">
									<label class="form-label span4" for="allowBook">Allow
										Book :</label>
									<div class="left marginT5 marginR10">
										<div class="normal-toggle-button">
											<input type="checkbox" class="nostyle"
												<c:if test="${entity.allowBook}">checked="checked"</c:if>
												fname="allowBook"> <input class="nostyle"
												type="radio"
												<c:if test="${entity.allowBook}">checked="checked"</c:if>
												name="allowBook" id="allowBook1" value="true"
												style="opacity: 0;"> <input class="nostyle"
												type="radio"
												<c:if test="${!entity.allowBook}">checked="checked"</c:if>
												name="allowBook" id="allowBook2" value="false"
												style="opacity: 0;">
										</div>
									</div>
								</div>
							</div>
						</div>


					</div>
				</form:form>
			</div>


		</div>
	</div>
</div>
<div class="hidden">
	<select style="width: 200px" id="LS-source">
		<c:forEach var="group" items="${groups}">
			<option value="${group.code}">${group.code}</option>
		</c:forEach>
	</select>
</div>
